﻿using CommunityToolkit.Mvvm.ComponentModel;
using System;
using System.Windows;
using System.Windows.Threading;

namespace KeZhou.Views.Components.Customs
{
    /// <summary>
    /// MyWarnBox.xaml 的交互逻辑
    /// </summary>
    public partial class MyWarnBox : Window
    {

        public MyWarnBox()
        {
            InitializeComponent();
        }

        public void Show(string newMsg)
        {
            warnText.Text = newMsg;
            this.Show();
            ShowInTaskbar = false;
            DispatcherTimer timer = new DispatcherTimer();
            timer.Interval = TimeSpan.FromSeconds(2);
            timer.Tick += (s, args) =>
            {
                this.Close();
                timer.Stop();
            };
            timer.Start();
        }
    }
}
